package com.xh.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.xh.entiy.Role;
import com.xh.repository.RoleRepository;

@Component
public class RoleService {
	@Autowired
	private RoleRepository roleRepository;
	
	public Role saveOrUpdateRole(Role role){
		 return roleRepository.save(role);
	}
	public List<Role> getRoles(){
		return  (List<Role>) roleRepository.findAll();
	}
	public Role getRole(Integer id){
		return roleRepository.findOne(id);
	}
	public void deleteRole(Integer id){
		roleRepository.delete(id);
	}
}
